<?php

class Application_Form_Cathedral extends Validation_Form
{

  public function init()
  {
  	/*
  	 * data to form
  	 */
  	$facultyDao = new Application_Model_Dao_Faculty();
  	$faculties = $facultyDao->getToSelect(); 
  	
  	/*
  	 * form
  	 */
    $this->setName("zendForm");
    $this->setMethod('post');
    
	$id = new Zend_Form_Element_Hidden('id');
	$id->addFilter('Int');

    $faculty = new Zend_Form_Element_Select('faculty_id');
   	$faculty->setLabel('Wydział')
   	    		   ->setMultiOptions($faculties)
   	    		   ->setRequired(true)
   	    		   ->addValidator('NotEmpty', true);
    
   	$cathedral = $this->createElement('text', 'designation');
   	$typeForm = $this->createElement('hidden','typeForm');
	$cathedral->setLabel('Katedra')
		->setRequired(TRUE)
		->setAttrib('size', 30)
		->addFilters(array(
		new Zend_Filter_StringTrim(),
		new Zend_Filter_StripNewlines(),
		new Zend_Filter_StripTags()
		))
		->addValidators(array(
		new Zend_Validate_NotEmpty(),
		new Zend_Validate_StringLength(array('min' => 5, 'max' => 30)),
		//new Zend_Validate_Alpha()
		));
   	$submit = new Zend_Form_Element_Submit('submit');
	$submit->setAttrib('id', 'submit');
    
    $this->addElements(array(
    	$id,
    	$faculty,
    	$cathedral,
    	$typeForm,
        $submit,
        ));
  }


}

	